<template>
    <div class="home-right">
        <div class="section-header">
            <div class="header-title">
                <img src="@/assets/images/a-picture/line2.png" alt="" />
                <span>经营主体区域分布</span>
            </div>
            <a-date-picker v-model:value="year1" picker="year" placeholder="请选择年份" @change="yearChange1()" />
        </div>
        <div class="ranking-tab">
            <div class="tr">
                <div class="th">
                    排名
                </div>
                <div class="th">
                    区域
                </div>
                <div class="th">
                    经营主体数量
                </div>
            </div>
            <div class="tr" v-for="(item, i) in companylist" :key="i">
                <div class="td">
                    <span class="rank" v-bind:class="{ 'rank1': i == 0, 'rank2': i == 1, 'rank3': i == 2 }">
                        {{ i + 1 }}
                    </span>

                </div>
                <div class="td">
                    {{ item.name }}
                </div>
                <div class="td">
                    {{ item.num }}
                </div>
            </div>
        </div>
        <!-- <div class="section-header">
            <div class="header-title">
                <img src="@/assets/images/a-picture/line2.png" alt="" />
                <span>公司分布汇总</span>
            </div>
        </div> -->
        <div class="section-header" style="margin-top: 10px;">
            <div class="header-title">
                <img src="@/assets/images/a-picture/line2.png" alt="" />
                <span>经营排名前5</span>
            </div>
<!--            <a-date-picker v-model:value="year" picker="year" placeholder="请选择年份" @change="yearChange()" /> -->
        </div>
        <section class="chart-item">
            <!-- <div class="section-title">
                <img src="@/assets/images/block.png" alt="" />
                <h4>经营排名前5</h4>
            </div> -->
            <div class="chart-box">
                <div class="chartsGl" id="medicamentCharts"></div>
            </div>
        </section>

    </div>
</template>
<script>
import {
    barEcharts,
    getEventProportions
} from "./ehartsModel";
export default {
    name: 'HomeLeft',
    data() {
        return {
            year: null,
            year1: null,

            // 页面标题
            title: '首页',
            // 页面标题
            description: '首页',
            keywords: null, //搜索关键词
            current: 1, //分页
            medicamentData: [{
                value: 485,
                name: "江西观澜山海农业发展有限公司"
            },
            {
                value: 272,
                name: "江西观澜山海农业发展有限公司1"
            },
            {
                value: 456,
                name: "江西观澜山海农业发展有限公司2"
            },
            {
                value: 91,
                name: "江西观澜山海农业发展有限公司3"
            },
            {
                value: 300,
                name: "江西观澜山海农业发展有限公司4"
            }
            ],
            companylist: []
        };
    },
    watch: {
        medicamentData: {
            handler() {
                this.medicamentCharts();
            },
            deep: true,
        },
    },
    mounted() {
        this.medicamentCharts();

        this.getdalist();
    },
    methods: {
        getdalist() {
            this.muajax.addressranking().then((res) => {
                this.companylist = res.data.list
            })
        },
        init() {
            this.medicamentCharts();
        },
        // 页面跳转
        goTo(path) {
            this.$router.push(path);
        },
        onSearch(e) {
            console.log(e)
        },
        handleChange(e) {
            console.log(e)
        },
        filterOption(input, option) {
            console.log(input, option)
            return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
        },
        /**
         * 点击公司
         * @param {*} item 
         */
        infoChange(item) {
            console.log(item)
            // let geom=
        },
        // 药剂使用量
        medicamentCharts() {
            let myChart = this.$echarts.init(
                document.getElementById("medicamentCharts")
            );
            // let namelist = this.medicamentData.map((item) => item.name);
            // let colorlist = ["#36E0FF", "#0084FF", " #54ECA5", "#DAC5F6", " #64B4F9"];
            let option = getEventProportions(this.medicamentData);
            myChart.setOption(option, true);
            window.addEventListener("resize", () => {
                myChart.resize();
            });

        },
        // 年份选择
        yearChange() {
            console.log(this.year)
        },
        //经营主体区域分布年份选择
        yearChange1(){}
    }
}
</script>
<style lang="less" scoped>
@import "@/assets/css/minxin.less";
@vw: 0.05208vw;

.section-header {
    // padding: 0px 10px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: url("@/assets/images/a-picture/line3.png") no-repeat center bottom;
    background-size: 100% 23px;
    margin-bottom: 8px;
    padding: 11px 10px;
    .flex-grow-0();

    .header-title {
        font-weight: bold;
        color: #14eba6;
        font-size: 16px;

        img {
            width: 11px;
            height: 20px;
            margin-right: 6px;
        }
    }

    .number {
        color: #ffffff;
        font-size: 14px;
        font-weight: bold;
    }
}

.home-right {
    position: absolute;
    right: 0px;
    top: 0px;
    width: 369px;
    background: linear-gradient(-90deg,
            rgba(0, 56, 46, 0.85) 50%,
            rgba(10, 75, 63, 0.05) 100%);
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    z-index: 9;
    height: 100%
}

.ranking-tab {
    width: 100%;
    // height: 300px;
    border: 1px solid #0e7d60;
    box-shadow: 0 0 10px 0 rgba(20, 235, 166, .5);
    border-radius: 5px;
    min-width: 0;
    -webkit-box-flex: 1;
    -webkit-flex-grow: 1;
    -ms-flex-positive: 1;
    flex-grow: 1;
    -webkit-flex-shrink: 1;
    -ms-flex-negative: 1;
    flex-shrink: 1;
    overflow-y: scroll;
    .gray-scroll-bar();

    .tr {
        display: flex;
        background: rgba(15, 162, 119, .2);

        .th {
            width: 33.33%;
            text-align: center;
            height: 40px;
            line-height: 40px;
            background: #0c9069;
            color: #fff;
            font-weight: bold;

        }

        .td {
            width: 33.33%;
            text-align: center;
            min-height: 40px;
            padding: 10px 0px;
            display: flex;
            align-items: center;
            justify-content: center;

        }

        &:nth-child(odd) {
            background: rgba(15, 162, 119, .5);
        }
    }

    .rank {
        width: 20px;
        height: 20px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 10px;
        color: #fff;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;

    }

    .rank1 {
        background: rgba(45, 175, 235, 1);
    }

    .rank2 {
        background: rgba(16, 182, 132, 1);
    }

    .rank3 {
        background: rgba(255, 197, 73, 1);
    }
}


.view-row {
    .flex-grow-1();
    overflow-y: auto;
    width: 354px;
    background: rgba(6, 61, 56, 0.7);
    border: 1px solid #0e7d60;
    box-shadow: 0px 0px 10px 0px rgba(20, 235, 166, 0.5) inset;
    border-radius: 5px;
    padding: 14px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;

    .view-filtration {
        display: flex;
        align-items: center;
        height: 32px;
        background: #0a4b3f;
        border: 1px solid #0ba071;
        border-radius: 6px;

        .ant-select-selector {
            background: none;

        }

        .flex-grow-0();

        // padding-left: 17px;
        input {
            background: none;
            border: 0px;
            color: #fff;
            .flex-grow-1();

            &:focus {
                border-color: rgba(255, 255, 255, 0);
            }
        }
    }

    .view-list {
        .flex-grow-1();
        overflow-y: scroll;
        .gray-scroll-bar();
    }

    .searhfor {
        width: 32px;
        height: 32px;
        background: #0c5b4c;
        box-shadow: 0px 0px 8px 0px rgba(20, 235, 166, 0.5) inset;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
    }

    .view-item {
        width: 100%;
        height: 76px;
        background: rgba(12, 96, 80, 0.65);
        border: 1px solid #076e4e;
        border-radius: 5px;
        padding: 14px;
        box-sizing: border-box;
        display: flex;
        margin-top: 14px;
        cursor: pointer;

        .v-ranking {
            .flex-grow-0;
            color: #ffffff;
            height: 18px;
            width: 18px;
            position: relative;
            text-align: center;
            font-size: 14px;
            color: #ffffff;
            margin-right: 10px;

            // .break1;
            img {
                position: absolute;
                bottom: 0px;
                left: 0px;
                width: 100%;
                // z-index: -1;
            }
        }

        .v-right {
            .flex-grow-1();

            .ds {
                margin-top: 10px;
            }

            .v-h1 {
                font-weight: bold;
                color: #14eba6;
                // .text-ellipsis;
                font-size: 16px;
            }

            span {
                font-size: 12px;
                color: #ffffff;
                opacity: 0.7;
            }
        }
    }

    .itemactive {
        background: #0c6050;
        border: 1px solid #0ba071;
        box-shadow: 0px 0px 18px 0px rgba(20, 235, 166, 0.5) inset;
    }
}

// input:-moz-placeholder {
//     color: #ccc;
// }

// input::-moz-placeholder {
//     color: #ccc;
// }

// input::-webkit-input-placeholder {
//     color: #ccc;
// }

// input:-ms-input-placeholder {
//     color: #ccc;
// }
.pagination {
    margin: 0px auto;
    padding-top: 10px;

    .ant-pagination-next button {
        color: #076e4e !important;
    }

    // color: #fff;
}


/deep/ .home-ant-input {
    height: 100%;
    line-height: 100%;

    .ant-input-group {
        height: 100%;
    }

    .ant-input {
        background: none;
        border: 0px;
        color: #fff;
        height: 100%;
        line-height: 100%;

        &::-ms-input-placeholder {
            color: #ccc;
        }

        &:-moz-placeholder {
            color: #ccc;
        }

        &::-moz-placeholder {
            color: #ccc;
        }

        &::-webkit-input-placeholder {
            color: #ccc;
        }

        &:-ms-input-placeholder {
            color: #ccc;
        }
    }

    .ant-btn-default {
        background-color: rgba(0, 56, 46, 0) !important;
        color: #fff !important;
        border: 0px !important;
        width: 32px;
        height: 32px;
        background: #0c5b4c;
        box-shadow: 0px 0px 8px 0px rgba(20, 235, 166, 0.5) inset;
        border-radius: 6px !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

.section-title {
    width: 100%;
    height: 43px;
    background-color: rgba(104, 133, 186, 0.18);
    border: solid 1px solid 1px rgba(104, 133, 186, 0.2);
    display: flex;
    align-items: center;
    font-family: AlibabaPuHuiTiM;
    font-size: 26px;
    font-weight: normal;
    font-style: italic;
    font-stretch: normal;
    letter-spacing: 1px;
    color: rgba(217, 235, 255, 1);
    position: relative;

    img {
        width: 47px;
        height: 31px;
        display: block;
        margin: 0px 7px;
    }

    .select {
        position: absolute;
        right: 12px;
        top: 0px;
    }

    h4 {
        font-weight: 300;
        margin-bottom: 0px;
    }
}

.chart-item {
    width: 100%;
    border: 1px solid #0e7d60;
    box-shadow: 0 0 10px 0 rgba(20, 235, 166, 0.5);
    border-radius: 5px;
    height: 219px;
    margin-top: 10px;
    min-width: 0;
    -webkit-box-flex: 0;
    -webkit-flex-grow: 0;
    -ms-flex-positive: 0;
    flex-grow: 0;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.chart-box {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    position: relative;

    .chartsGl {
        width: 100% !important;
        height: 100% !important;
    }

    #sevendaysCharts {
        width: 100% !important;
        height: 100% !important;
    }
}

.Daytradinge-box {
    height: 270px;
}

/deep/ .ant-picker {
    background: none;
    color: #fff;
    .ant-picker-suffix{
        color: #fff;
    }
}

/deep/ .ant-picker .ant-picker-input>input {
    color: #fff;

    &::-ms-input-placeholder {
        color: #ccc;
    }

    &:-moz-placeholder {
        color: #ccc;
    }

    &::-moz-placeholder {
        color: #ccc;
    }

    &::-webkit-input-placeholder {
        color: #ccc;
    }

    &:-ms-input-placeholder {
        color: #ccc;
    }
}

// /deep/ .ant-pagination.ant-pagination-simple .ant-pagination-simple-pager input {
//     background: none;
//     border: solid 1px #0c5b4c;
//     color: #fff;
// }</style>